package com.AAA.service.Impl.sas;

import com.AAA.dao.sas.ITSasRecordMapper;
import com.AAA.entity.MyPage;
import com.AAA.entity.sas.TSasRecord;
import com.AAA.service.sas.TSasRecordService;

import com.AAA.entity.sas.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * (TSasRecord)表服务实现类
 *
 * @author 何泽明
 * @since 2022-10-29 18:18:29
 */
@Service
public class TSasRecordServiceImpl implements TSasRecordService {
   @Autowired
   private ITSasRecordMapper mapper;

   @Override
   public TSasRecord checkRecord(TSasRecord record) {
      TSasRecord tSasRecord = mapper.selectOne(record);
      return tSasRecord;
   }

   @Override
   public int insertRecord(TSasRecord record) {
      record.setCreatetime(new Date());
      int i = mapper.insert(record);
      System.out.println(record.getId());
      return record.getId();
   }

   @Override
   public PageInfo getAll(MyPage myPage, TSasRecord record) {
      PageHelper.startPage(myPage.getPage(), myPage.getLimit());
      List<TSasRecord> select = mapper.queryall(record);
      PageInfo pageInfo = new PageInfo(select);
      return pageInfo;
   }

   @Override
   public PageInfo getDetailMsg(Integer id,MyPage myPage) {
      PageHelper.startPage(myPage.getPage(), myPage.getLimit());
      List<Map<String,Object>> details = mapper.getDetails(id);
      PageInfo pageInfo = new PageInfo(details);
      return pageInfo;
   }


   @Override
   public PageInfo selectcore(MyPage myPage, TSasRecordjieguo record) {
      PageHelper.startPage(myPage.getPage(), myPage.getLimit());
      List<TSasRecordjieguo> select = mapper.selectjiguo(record);
      PageInfo pageInfo = new PageInfo<>(select);
      return pageInfo;
   }

   @Override
   public PageInfo selectren(MyPage myPage, TSasRecordren record) {
      PageHelper.startPage(myPage.getPage(), myPage.getLimit());
      List<TSasRecordren> select = mapper.selectren(record);
      PageInfo pageInfo = new PageInfo<>(select);
      return pageInfo;
   }
}

